<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover"><title>AiKIKI - Welcome!</title><meta name="author" content="樵子"><meta name="copyright" content="樵子"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="referrer" content="no-referrer"><meta name="description" content="Always CREATIVE.">
<meta property="og:type" content="website">
<meta property="og:title" content="AiKIKI">
<meta property="og:url" content="https://www.aikiki.top/index.html">
<meta property="og:site_name" content="AiKIKI">
<meta property="og:description" content="Always CREATIVE.">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/avatar.png">
<meta property="article:author" content="樵子">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/avatar.png"><link rel="shortcut icon" href="https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/favicon.ico"><link rel="canonical" href="https://www.aikiki.top/index.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = {
  root: '/',
  algolia: undefined,
  localSearch: undefined,
  translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"簡"},
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  dateSuffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  infinitegrid: {
    js: 'https://cdn.jsdelivr.net/npm/@egjs/infinitegrid/dist/infinitegrid.min.js',
    buttonText: '加载更多'
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: false,
  percent: {
    toc: true,
    rightside: false,
  },
  autoDarkmode: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'AiKIKI',
  isPost: false,
  isHome: true,
  isHighlightShrink: false,
  isToc: false,
  postUpdate: '2023-12-28 09:46:04'
}</script><script>(win=>{
      win.saveToLocal = {
        set: (key, value, ttl) => {
          if (ttl === 0) return
          const now = Date.now()
          const expiry = now + ttl * 86400000
          const item = {
            value,
            expiry
          }
          localStorage.setItem(key, JSON.stringify(item))
        },
      
        get: key => {
          const itemStr = localStorage.getItem(key)
      
          if (!itemStr) {
            return undefined
          }
          const item = JSON.parse(itemStr)
          const now = Date.now()
      
          if (now > item.expiry) {
            localStorage.removeItem(key)
            return undefined
          }
          return item.value
        }
      }
    
      win.getScript = (url, attr = {}) => new Promise((resolve, reject) => {
        const script = document.createElement('script')
        script.src = url
        script.async = true
        script.onerror = reject
        script.onload = script.onreadystatechange = function() {
          const loadState = this.readyState
          if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
          script.onload = script.onreadystatechange = null
          resolve()
        }

        Object.keys(attr).forEach(key => {
          script.setAttribute(key, attr[key])
        })

        document.head.appendChild(script)
      })
    
      win.getCSS = (url, id = false) => new Promise((resolve, reject) => {
        const link = document.createElement('link')
        link.rel = 'stylesheet'
        link.href = url
        if (id) link.id = id
        link.onerror = reject
        link.onload = link.onreadystatechange = function() {
          const loadState = this.readyState
          if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
          link.onload = link.onreadystatechange = null
          resolve()
        }
        document.head.appendChild(link)
      })
    
      win.activateDarkMode = () => {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = () => {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
        if (t === 'dark') activateDarkMode()
        else if (t === 'light') activateLightMode()
      
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
      const detectApple = () => {
        if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
          document.documentElement.classList.add('apple')
        }
      }
      detectApple()
    })(window)</script><meta name="generator" content="Hexo 7.0.0"><link rel="alternate" href="/atom.xml" title="AiKIKI" type="application/atom+xml">
</head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/avatar.png" onerror="onerror=null;src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">28</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">21</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">1</div></a></div><hr class="custom-hr"/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> Link</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> About</span></a></div></div></div></div><div class="page" id="body-wrap"><header class="full_page" id="page-header" style="background-image: url('https://open.saintic.com/api/bingPic/')"><nav id="nav"><span id="blog-info"><a href="/" title="AiKIKI"><span class="site-name">AiKIKI</span></a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> Link</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> About</span></a></div></div><div id="toggle-menu"><a class="site-page" href="javascript:void(0);"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="site-info"><h1 id="site-title">AiKIKI</h1><div id="site-subtitle"><span id="subtitle"></span></div><div id="site_social_icons"><a class="social-icon" href="https://github.com/acmeist" target="_blank" title="Github"><i class="fab fa-github" style="color: #24292e;"></i></a><a class="social-icon" href="mailto:huweighost@gmail.com" target="_blank" title="Email"><i class="fas fa-envelope" style="color: #4a7dbe;"></i></a><a class="social-icon" href="/atom.xml" target="_blank" title="Rss"><i class="fas fa-rss"></i></a></div></div><div id="scroll-down"><i class="fas fa-angle-down scroll-down-effects"></i></div></header><main class="layout" id="content-inner"><div class="recent-posts" id="recent-posts"><div class="recent-post-item"><div class="post_cover left"><a href="/post/c3b4/" title="Docker 使用宿主机网段"><img class="post-bg" src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/docker-logo-horizontal.jfif" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/404.jpg'" alt="Docker 使用宿主机网段"></a></div><div class="recent-post-info"><a class="article-title" href="/post/c3b4/" title="Docker 使用宿主机网段">Docker 使用宿主机网段</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-12-18T01:27:00.000Z" title="发表于 2023-12-18 09:27:00">2023-12-18</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Archives/">Archives</a></span></div><div class="content">Docker 使用宿主机网段多是使用 MacVlan 创建虚拟网络实现。但本人在 RockyLinux 9.3 （ESXi 中运行的虚拟机）测试结果不尽人意。主要问题是：容器无法访问宿主机所在局域网网关和网段内的其它 IP 地址。(PS:后续查询资料，该问题是未开启 ESXi 的网卡混杂模式。另所查资料原文说 MacVlan 模式 1 个物理网卡仅支持 2 台虚拟机，超出 2 台后掉包严重，原因不明。)
最后改用了 Docker 新的 IpVlan 驱动方式解决问题。

IpVlan 和 MacVlan 使用方法基本一致，个别参数有差别，但基本上用不到。

创建 IpVlan 网络创建 IpVlan 网络：
12345678910docker network create \-d ipvlan \--subnet=192.168.1.0/24 \--gateway=192.168.1.1 \--ipv6 \--subnet=fd00:db8:1:ddee::/64 \--gateway=fd00:db8:1:ddee::1 \-o ipvlan_mode=l2 \-o parent=e ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/post/1e36/" title="ESXi 远程 SSH 终端登录显示器管理界面"><img class="post-bg" src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/esxi-logo-horizontal.jfif" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/404.jpg'" alt="ESXi 远程 SSH 终端登录显示器管理界面"></a></div><div class="recent-post-info"><a class="article-title" href="/post/1e36/" title="ESXi 远程 SSH 终端登录显示器管理界面">ESXi 远程 SSH 终端登录显示器管理界面</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-11-29T01:45:00.000Z" title="发表于 2023-11-29 09:45:00">2023-11-29</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Archives/">Archives</a></span></div><div class="content">
ESXi 主机通常不接显示器、键盘和鼠标，有时候需要登录显示器管理界面很不方便。ESXi 提供了远程 SSH 终端登录此管理界面的功能，即是指令 dcui。

开启 SSH在主机-操作-服务-启用 Secure Shell (SSH)。
登录 SSH 终端使用你喜欢的 SSH 软件登录 ESXi。
登录显示器管理界面在 SSH 终端输入以下代码进入显示器管理界面：
12TERM=xtermdcui

ps：TERM 为终端环境变量。可以不设置此变量，直接输入 dcui 进入显示器管理界面。
</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/post/9973/" title="ESXi 6.7 自动关机设置"><img class="post-bg" src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/esxi-logo-horizontal.jfif" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/404.jpg'" alt="ESXi 6.7 自动关机设置"></a></div><div class="recent-post-info"><a class="article-title" href="/post/9973/" title="ESXi 6.7 自动关机设置">ESXi 6.7 自动关机设置</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-11-25T07:12:00.000Z" title="发表于 2023-11-25 15:12:00">2023-11-25</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Archives/">Archives</a></span></div><div class="content">开启 SSH在主机-操作-服务-启用 Secure Shell (SSH)。
登录 SSH 终端使用你喜欢的 SSH 软件登录 ESXi。
编写关机脚本文件进入存储空间目录
关机脚本文件需放到存储目录中，否则 ESXi 重启会丢失配置的文件。

1cd /vmfs/volumes/datastore1

编辑关机脚本文件123mkdir script  # 创建脚本文件存放目录cd scriptvi poweroff.sh

在编辑框输入以下内容并保存退出：
12345678910#!/bin/sh#shutdown all VMs(2,3,9 is VMID,add your VMIDs here)#vim-cmd vmsvc/power.shutdown 1#vim-cmd vmsvc/power.off 1#vim-cmd vmsvc/power.shutdown 2#vim-cmd vmsvc/power.off 2#Poweroff Host/sbin/poweroff


前面注释的代码用于关闭虚拟机。我在各个虚拟机中配置了自动关机，因此注释。

设置脚本权限为 755:
 ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/post/bf0c/" title="OpenWrt 安装自带 Tailscale 和 ZeroTier"><img class="post-bg" src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/openwrt-logo-horizontal.jfif" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/404.jpg'" alt="OpenWrt 安装自带 Tailscale 和 ZeroTier"></a></div><div class="recent-post-info"><a class="article-title" href="/post/bf0c/" title="OpenWrt 安装自带 Tailscale 和 ZeroTier">OpenWrt 安装自带 Tailscale 和 ZeroTier</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-11-21T01:19:00.000Z" title="发表于 2023-11-21 09:19:00">2023-11-21</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Archives/">Archives</a></span></div><div class="content">官方网站
OpenWrt 软路由固件下载与在线定制编译
Tailscale · Best VPN Service for Secure Networks
ZeroTier | Global Area Networking


OpenWrt 的安装、Tailscale 和 ZeroTier 使用方法参见网上教程。

安装软件包既然是安装系统自带包，使用 OpenWrt 的软件包功能安装即可。安装前先更新列表...。
安装 Tailscale
OpenWrt 22.03.x 以上版本需要安装包 iptables-nft，直接搜索该名称安装。
tailscale 搜索名称安装即可，系统会安装 tailscale 和 tailscaled。
安装完成后一定要重启。

卸载后的清理，推荐使用卸载脚本：
1wget --tries=5 -c -t 60 -O- https://gh.api.99988866.xyz/https://raw.githubusercontent.com/CH3NGYZ/tailscale-openwrt/chinese_mainland/uninstall.sh | ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/post/53a7/" title="OpenWrt 更新所有已安装软件包"><img class="post-bg" src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/openwrt-logo-horizontal.jfif" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/404.jpg'" alt="OpenWrt 更新所有已安装软件包"></a></div><div class="recent-post-info"><a class="article-title" href="/post/53a7/" title="OpenWrt 更新所有已安装软件包">OpenWrt 更新所有已安装软件包</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-11-15T01:38:00.000Z" title="发表于 2023-11-15 09:38:00">2023-11-15</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Archives/">Archives</a></span></div><div class="content">登录 SSH
使用任意 SSH 软件登录 OpenWrt。

更新软件列表1opkg update

更新所有软件包1opkg list-upgradable | cut -f 1 -d &#x27; &#x27; | xargs opkg upgrade

</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/post/c8b7/" title="Docker-操作指令收集"><img class="post-bg" src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/docker-logo-horizontal.jfif" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/404.jpg'" alt="Docker-操作指令收集"></a></div><div class="recent-post-info"><a class="article-title" href="/post/c8b7/" title="Docker-操作指令收集">Docker-操作指令收集</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-07-18T01:47:00.000Z" title="发表于 2021-07-18 09:47:00">2021-07-18</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Archives/">Archives</a></span></div><div class="content">查看容器环境变量如果我们需要查看 ENV 设置的环境变量，可以通过以下几个方法进行查看。

使用 docker inspect 命令来查看

1$ docker inspect &lt;CONTAINER-NAME&gt; OR &lt;CONTAINER-ID&gt;


使用 docker exec -it &lt;CONTAINER-NAME&gt; OR &lt;CONTAINER-ID&gt; env查看

进入容器exec 命令-i -t 参数docker exec 后边可以跟多个参数，这里主要说明 -i -t 参数。
只用 -i 参数时，由于没有分配伪终端，界面没有我们熟悉的 Linux 命令提示符，但命令执行结果仍然可以返回。
当 -i -t 参数一起使用时，则可以看到我们熟悉的 Linux 命令提示符。
1docker exec -i &lt;CONTAINER-NAME&gt; OR &lt;CONTAINER-ID&gt;  /bin/bash

从容器里面复制文件1docker cp &lt;CONTAINER-NAME&gt; OR &lt;CONTAINER ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/post/872e/" title="Rocky Linux 8 安装 Docker-CE"><img class="post-bg" src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/rockylinux-logo-horizontal.jfif" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/404.jpg'" alt="Rocky Linux 8 安装 Docker-CE"></a></div><div class="recent-post-info"><a class="article-title" href="/post/872e/" title="Rocky Linux 8 安装 Docker-CE">Rocky Linux 8 安装 Docker-CE</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-07-14T09:06:00.000Z" title="发表于 2021-07-14 17:06:00">2021-07-14</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Archives/">Archives</a></span></div><div class="content">Red Hat 系的 Linux 取消了 Docker，改为了 Podman。
因此需要单独增加 Repo 源才能安装。
此安装方法适用于 Red Hat&#x2F;CentOS&#x2F;Rocky Linux&#x2F;Alma Linux&#x2F;Oracle Linux 等 Red Hat 系的 Linux 操作系统。
卸载 PodmanRocky Linux 默认安装了 Podman，需要先卸载。否则会和 Docker 依赖组件冲突。
1yum -y erase podman buildah

安装 Docker安装 Docker Repo 源12345# 添加 Docker Repodnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo# 更新源dnf update

官方源和阿里云源，按需替换。

Docker 官方源：https://download.docker.com/linux/centos/


Docker 阿里云源：https://mirro ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/post/52ea/" title="CentOS 8 配置 Web Console"><img class="post-bg" src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/centos-logo-horizontal.jfif" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/404.jpg'" alt="CentOS 8 配置 Web Console"></a></div><div class="recent-post-info"><a class="article-title" href="/post/52ea/" title="CentOS 8 配置 Web Console">CentOS 8 配置 Web Console</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-06-12T06:15:00.000Z" title="发表于 2021-06-12 14:15:00">2021-06-12</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Archives/">Archives</a></span></div><div class="content">CentOS 8 启动之后，使用 SSH 登录发现了一行提示：Activate the web console with: systemctl enable –now cockpit.socket。
出于好奇搜索了下 cockpit，发现是个好东西。
这条命令是提示可以激活系统的 Web管理程序，设置系统开机启动。
什么是 Cockpit ?官方网站：https://cockpit-project.org/。Cockpit 官网介绍：

Cockpit makes GNU&#x2F;Linux discoverable. See your server in a web browser and perform system tasks with a mouse. It’s easy to start containers, administer storage, configure networks, and inspect logs.Cockpit 是一个 Web 端的系统管理工具，只用鼠标就能管理系统，事实上也确实如此，启动 Cockpit 服务之后，只需要鼠标就能完成系统很多基础 ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/post/3f4b/" title="CentOS 8 虚拟机设置网卡"><img class="post-bg" src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/centos-logo-horizontal.jfif" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/404.jpg'" alt="CentOS 8 虚拟机设置网卡"></a></div><div class="recent-post-info"><a class="article-title" href="/post/3f4b/" title="CentOS 8 虚拟机设置网卡">CentOS 8 虚拟机设置网卡</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-06-09T06:07:00.000Z" title="发表于 2021-06-09 14:07:00">2021-06-09</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Archives/">Archives</a></span></div><div class="content">CentOS 8 在虚拟机新增加的网卡，不会生成网卡配置文件。这是因为从该版本开始，CentOS 停止了 network.service，只能通过 NetworkManager 进行网络配置。
启动 NetworkManager1systemctl start NetworkManager

获取网卡名称输入指令：
1nmcli device

系统显示：
123DEVICE  TYPE      STATE   CONNECTIONens35   ethernet  已连接  ens35lo      loopback  未托管  --


ens35 即为网卡设备名称。这里因为已经连接设备，所以后面的状态显示为已连接。

连接网卡设备输入以下指令连接设备。
12nmcli connection add con-name ens35 ifname ens35 type ethernetnmcli connection up ens35


ens35 为要连接设备的新名称。

设备链接成功，在文件夹：/etc/sysconfig/network-scripts/ 会自动生成配置文件  ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/post/52bd/" title="CentOS 8 时间同步"><img class="post-bg" src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/centos-logo-horizontal.jfif" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/404.jpg'" alt="CentOS 8 时间同步"></a></div><div class="recent-post-info"><a class="article-title" href="/post/52bd/" title="CentOS 8 时间同步">CentOS 8 时间同步</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-06-07T05:55:00.000Z" title="发表于 2021-06-07 13:55:00">2021-06-07</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Archives/">Archives</a></span></div><div class="content">CentOS 推荐使用 chrony 同步时间。chrony 官网列举了诸多 chrony 优于 ntp 的功能。

https://chrony.tuxfamily.org/comparison.html

安装 chrony1yum -y install chrony


默认 CentOS 已经安装了 chrony

配置 chrony备份配置文件1cp /etc/chrony.conf /etc/chrony.conf.backup

编辑配置文件1nano /etc/chrony.conf

在打开文件的头部增加以下配置内容：
123server ntp1.alyun.comserver ntp2.alyun.comserver ntp3.alyun.com

启动相关服务1234systemctl start chronydsystemctl enable chronydsystemctl start crondsystemctl enable crond
</div></div></div><nav id="pagination"><div class="pagination"><span class="page-number current">1</span><a class="page-number" href="/page/2/#content-inner">2</a><a class="page-number" href="/page/3/#content-inner">3</a><a class="extend next" rel="next" href="/page/2/#content-inner"><i class="fas fa-chevron-right fa-fw"></i></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/avatar.png" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">樵子</div><div class="author-info__description">Always CREATIVE.</div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">28</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">21</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">1</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/acmeist"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/acmeist" target="_blank" title="Github"><i class="fab fa-github" style="color: #24292e;"></i></a><a class="social-icon" href="mailto:huweighost@gmail.com" target="_blank" title="Email"><i class="fas fa-envelope" style="color: #4a7dbe;"></i></a><a class="social-icon" href="/atom.xml" target="_blank" title="Rss"><i class="fas fa-rss"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">感謝訪問本站，若喜歡請收藏 ^_^</div></div><div class="sticky_layout"><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/post/c3b4/" title="Docker 使用宿主机网段"><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/docker-logo-horizontal.jfif" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/404.jpg'" alt="Docker 使用宿主机网段"/></a><div class="content"><a class="title" href="/post/c3b4/" title="Docker 使用宿主机网段">Docker 使用宿主机网段</a><time datetime="2023-12-18T01:27:00.000Z" title="发表于 2023-12-18 09:27:00">2023-12-18</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/post/1e36/" title="ESXi 远程 SSH 终端登录显示器管理界面"><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/esxi-logo-horizontal.jfif" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/404.jpg'" alt="ESXi 远程 SSH 终端登录显示器管理界面"/></a><div class="content"><a class="title" href="/post/1e36/" title="ESXi 远程 SSH 终端登录显示器管理界面">ESXi 远程 SSH 终端登录显示器管理界面</a><time datetime="2023-11-29T01:45:00.000Z" title="发表于 2023-11-29 09:45:00">2023-11-29</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/post/9973/" title="ESXi 6.7 自动关机设置"><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/esxi-logo-horizontal.jfif" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/404.jpg'" alt="ESXi 6.7 自动关机设置"/></a><div class="content"><a class="title" href="/post/9973/" title="ESXi 6.7 自动关机设置">ESXi 6.7 自动关机设置</a><time datetime="2023-11-25T07:12:00.000Z" title="发表于 2023-11-25 15:12:00">2023-11-25</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/post/bf0c/" title="OpenWrt 安装自带 Tailscale 和 ZeroTier"><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/openwrt-logo-horizontal.jfif" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/404.jpg'" alt="OpenWrt 安装自带 Tailscale 和 ZeroTier"/></a><div class="content"><a class="title" href="/post/bf0c/" title="OpenWrt 安装自带 Tailscale 和 ZeroTier">OpenWrt 安装自带 Tailscale 和 ZeroTier</a><time datetime="2023-11-21T01:19:00.000Z" title="发表于 2023-11-21 09:19:00">2023-11-21</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/post/53a7/" title="OpenWrt 更新所有已安装软件包"><img src="https://cdn.jsdelivr.net/gh/acmeist/CDN/logos/openwrt-logo-horizontal.jfif" onerror="this.onerror=null;this.src='https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/404.jpg'" alt="OpenWrt 更新所有已安装软件包"/></a><div class="content"><a class="title" href="/post/53a7/" title="OpenWrt 更新所有已安装软件包">OpenWrt 更新所有已安装软件包</a><time datetime="2023-11-15T01:38:00.000Z" title="发表于 2023-11-15 09:38:00">2023-11-15</time></div></div></div></div><div class="card-widget card-categories"><div class="item-headline">
            <i class="fas fa-folder-open"></i>
            <span>分类</span>
            
            </div>
            <ul class="card-category-list" id="aside-cat-list">
            <li class="card-category-list-item "><a class="card-category-list-link" href="/categories/Archives/"><span class="card-category-list-name">Archives</span><span class="card-category-list-count">28</span></a></li>
            </ul></div><div class="card-widget card-tags"><div class="item-headline"><i class="fas fa-tags"></i><span>标签</span></div><div class="card-tag-cloud"><a href="/tags/CentOS/" style="font-size: 1.5em; color: #99a9bf">CentOS</a> <a href="/tags/ZeroTier/" style="font-size: 1.1em; color: #999">ZeroTier</a> <a href="/tags/Docker/" style="font-size: 1.43em; color: #99a6b9">Docker</a> <a href="/tags/Apache/" style="font-size: 1.1em; color: #999">Apache</a> <a href="/tags/Tailscale/" style="font-size: 1.1em; color: #999">Tailscale</a> <a href="/tags/Compute-Engine/" style="font-size: 1.1em; color: #999">Compute Engine</a> <a href="/tags/Nginx/" style="font-size: 1.17em; color: #999c9f">Nginx</a> <a href="/tags/ESXi/" style="font-size: 1.17em; color: #999c9f">ESXi</a> <a href="/tags/IpVlan/" style="font-size: 1.1em; color: #999">IpVlan</a> <a href="/tags/WordPress/" style="font-size: 1.1em; color: #999">WordPress</a> <a href="/tags/PHP/" style="font-size: 1.3em; color: #99a1ac">PHP</a> <a href="/tags/MariaDB/" style="font-size: 1.23em; color: #999ea6">MariaDB</a> <a href="/tags/Rocky-Linux/" style="font-size: 1.1em; color: #999">Rocky Linux</a> <a href="/tags/OpenWrt/" style="font-size: 1.17em; color: #999c9f">OpenWrt</a> <a href="/tags/phpMyAdmin/" style="font-size: 1.23em; color: #999ea6">phpMyAdmin</a> <a href="/tags/Debian/" style="font-size: 1.37em; color: #99a4b2">Debian</a> <a href="/tags/Proxmox-VE/" style="font-size: 1.23em; color: #999ea6">Proxmox VE</a> <a href="/tags/Google-Cloud/" style="font-size: 1.1em; color: #999">Google Cloud</a> <a href="/tags/Synology/" style="font-size: 1.1em; color: #999">Synology</a> <a href="/tags/Linux/" style="font-size: 1.1em; color: #999">Linux</a> <a href="/tags/Cockpit/" style="font-size: 1.1em; color: #999">Cockpit</a></div></div><div class="card-widget card-archives"><div class="item-headline"><i class="fas fa-archive"></i><span>归档</span><a class="card-more-btn" href="/archives/" title="查看更多">
    <i class="fas fa-angle-right"></i></a></div><ul class="card-archive-list"><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/12/"><span class="card-archive-list-date">十二月 2023</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/11/"><span class="card-archive-list-date">十一月 2023</span><span class="card-archive-list-count">4</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/07/"><span class="card-archive-list-date">七月 2021</span><span class="card-archive-list-count">2</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/06/"><span class="card-archive-list-date">六月 2021</span><span class="card-archive-list-count">3</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/03/"><span class="card-archive-list-date">三月 2021</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2020/06/"><span class="card-archive-list-date">六月 2020</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2020/05/"><span class="card-archive-list-date">五月 2020</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2020/03/"><span class="card-archive-list-date">三月 2020</span><span class="card-archive-list-count">11</span></a></li></ul></div><div class="card-widget card-webinfo"><div class="item-headline"><i class="fas fa-chart-line"></i><span>网站资讯</span></div><div class="webinfo"><div class="webinfo-item"><div class="item-name">文章数目 :</div><div class="item-count">28</div></div><div class="webinfo-item"><div class="item-name">本站总字数 :</div><div class="item-count">18.9k</div></div><div class="webinfo-item"><div class="item-name">本站访客数 :</div><div class="item-count" id="busuanzi_value_site_uv"><i class="fa-solid fa-spinner fa-spin"></i></div></div><div class="webinfo-item"><div class="item-name">本站总访问量 :</div><div class="item-count" id="busuanzi_value_site_pv"><i class="fa-solid fa-spinner fa-spin"></i></div></div><div class="webinfo-item"><div class="item-name">最后更新时间 :</div><div class="item-count" id="last-push-date" data-lastPushDate="2023-12-28T01:46:04.365Z"><i class="fa-solid fa-spinner fa-spin"></i></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2023 By 樵子</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text"><a target="_blank" rel="noopener" href="https://beian.miit.gov.cn/"><img class="icp-icon" src="https://cdn.jsdelivr.net/gh/acmeist/CDN/www/img/icp.png"><span>渝ICP备19007019号</span></a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="translateLink" type="button" title="简繁转换">繁</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside-config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/js/tw_cn.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.umd.min.js"></script><div class="js-pjax"><script>window.typedJSFn = {
  init: (str) => {
    window.typed = new Typed('#subtitle', Object.assign({
      strings: str,
      startDelay: 300,
      typeSpeed: 150,
      loop: true,
      backSpeed: 50,
    }, null))
  },
  run: (subtitleType) => {
    if (true) {
      if (typeof Typed === 'function') {
        subtitleType()
      } else {
        getScript('https://cdn.jsdelivr.net/npm/typed.js/dist/typed.umd.min.js').then(subtitleType)
      }
    } else {
      subtitleType()
    }
  }
}
</script><script>function subtitleType () {
  if (true) {
    typedJSFn.init(["今日事,今日畢","Never put off till tomorrow what you can do today"])
  } else {
    document.getElementById("subtitle").textContent = "今日事,今日畢"
  }
}
typedJSFn.run(subtitleType)</script></div><script defer="defer" id="fluttering_ribbon" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/canvas-fluttering-ribbon.min.js"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>